#include <amxmodx>
#include <fun>
#include <rpgx>

#define DMG_PERCENT 7.5

new upgrade_id;

public plugin_init()
	register_plugin("Vampire RPGx Upgrade", "2.0", "roflmao456");

public RPGx_OnPluginReady()
	upgrade_id = RPGx_MakeUpgrade("Vampire", 10, 15, 10);

public RPGx_OnPlayerHurt(victim, attacker, damage, weapon){
	new level = RPGx_GetUpgradeLevel(attacker, upgrade_id);
	if(level){
		new health = get_user_health(attacker), bonus = RPGx_GetSpawnHealth(attacker),
			steal = floatround(damage * (DMG_PERCENT * float(level) / 100.0));
		set_user_health(attacker, health+steal<bonus?health+steal:bonus);
		}
	}